<include file="Public/header" />

	<body>
		<div class="mui-content">
			<header class="mui-bar mui-bar-nav pub_head">
				<a class="mui-action-back mui-icon mui-pull-left iconfont icon-left" href="javascript:history.go(-1)"></a>
				<h1 class="mui-title">明星教师</h1>
				<a class="mui-icon mui-pull-right iconfont icon-house1" style="font-size:26px;padding-top:0.5rem;" href='/'></a>
			</header>
                    <if condition=" !empty($teacher) ">
			<ul class="mui-table-view mTop teach_list">
                    
                            <foreach name='teacher' item='vo'>
				<li class="mui-table-view-cell mui-media">
					<a href="javascript:;">
						<img class="mui-media-object mui-pull-left" src="{$vo.head}">
						<div class="mui-media-body">
							{$vo.name}
                                                        <p class="mui-ellipsis teach_mTop">{$vo.c_name}<if condition=" $vo['b_name'] ">({$vo.b_name})</if><if condition=" $vo['teacher_type'] eq 1 ">班主任老师<elseif condition=" $vo['teacher_type'] eq 2 "/>生活老师<elseif condition=" $vo['teacher_type'] eq 3 "/>配班老师<else/>保健老师</if></p>
						</div>
					</a>
                                    <a style="position: static;display: table-caption;" href="#" onclick="massage({$vo.uid})"><span class="iconfont icon-liuyan"></span></a>
					<a id="openPopover" style="position: static;display: table-caption;" href="#popover" onclick="a('{$vo.head}','{$vo.name}',{$vo.phone})"><span class="iconfont icon-icon1"></span></a>
				</li>
                            </foreach>
			</ul>
                        <else/>
                        <div class="mui-content">
		    <div class="no-message">
		    	<i class="iconfont icon-zanwuxiaoxitixing"></i>
		    	<p>暂无消息</p>
		    </div>
		</div>
                    </if>
			<div id="" class="mui-popover teach_detail" name="popover">
				<div class="mui-scroll-wrapper">
					<div class="mui-scroll">
						<!--<ul class="mui-table-view">
	    			    	<li class="mui-table-view-cell"><a href="#">Item1</a></li>
	    			    	<li class="mui-table-view-cell"><a href="#">Item2</a></li>
	    			    	<li class="mui-table-view-cell"><a href="#">Item3</a></li>
	    			    	<li class="mui-table-view-cell"><a href="#">Item4</a></li>
	    			    	<li class="mui-table-view-cell"><a href="#">Item5</a></li>
	    			    </ul>-->
						<div class="teach_pop_img">
							<img id='img' src="../images/logo1.jpg" />
                                                        <i class="iconfont icon-chahao"></i>
						</div>
						<div class="teach_pop_phone">
							<a id='tel' href="">
								<span id='name'>联系</span>
								<i class="iconfont icon-youjiantou"></i>
							</a>
						</div>
					</div>
				</div>
			</div>
		</div>
		<script type="text/javascript">
			/*$(function(){
							$(".teach_liuyan").on("click",function(){
								window.location.href = "";
							});
						})*/
			mui('.mui-scroll-wrapper').scroll();
                        
                        $(".icon-chahao").on("click", function(){
				mui('.mui-popover').popover('toggle',document.getElementById("openPopover"));
			});
                        
                        function a(head,name,phone){
                              $('#img').attr("src",head);
                              $('#name').html("联系"+name);
                              $('#tel').attr("href","tel:"+phone);
                              mui('.mui-popover').popover('toggle',document.getElementById("openPopover"));
                        }
                        function massage(uid){
                            var html = '<div class="mui-content">';
                            html+='<header class="mui-bar mui-bar-nav pub_head"><a class=" mui-icon mui-pull-left iconfont " style="font-size:1rem;margin-top:0.7rem;" href="#" onclick="getclose()">取消</a><h1 class="mui-title">留言</h1><a class=" mui-icon mui-pull-right iconfont  " style="font-size:1rem;margin-top:0.7rem;" href="#" onclick="getMassage('+uid+')">发布</a></header>';
                            html+='<form class="mui-input-group" style="margin-top:30px;"><textarea style="width:100%;height:156px;" placeholder="请输入留言....." id="content"></textarea></form>';
                            html+='</div>';
                            layer.open({
                                type: 1
                                ,content: html
                                ,shadeClose:false
                                ,anim: 'up'
                                ,style: 'position:fixed; bottom:0; left:0; width: 100%; height: 200px; padding:10px 0; border:none;'
                            });
                        }
                        function getMassage(uid){
                             var content = $('#content').val();
                             layer.open({
                                type: 2
                                ,content: '留言中'
                                ,shadeClose:false
                              });
                              $.ajax({
                                  url:"{:U('User/massage')}",
                                  type:"post",
                                  data:{uid:uid,content:content},
                                  success:function(e){
                                      layer.closeAll();
                                      if(e == 1){
                                           layer.open({
                                                content: '留言成功'
                                                ,skin: 'msg'
                                                ,time: 2 //2秒后自动关闭
                                            });
                                      }else if(e==2){
                                          layer.open({
                                                content: '请填写留言内容'
                                                ,skin: 'msg'
                                                ,time: 2 //2秒后自动关闭
                                            });
                                      }else{
                                          layer.open({
                                                content: '留言失败'
                                                ,skin: 'msg'
                                                ,time: 2 //2秒后自动关闭
                                            });
                                      }
                                  }
                              })
                        }
                        function getclose(){
                            layer.closeAll();
                        }
		</script>
	</body>

</html>